<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆</title>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<script src="RSA.js"></script>
<script>
    function f() {
        var username = $("#inputText1").val();
        var pswd = $("#inputText2").val();
        $.ajax({
            url:'json_test.php',
            data:{"username":rsa_encode(username), "pswd":rsa_encode(pswd)},
            type:'post',

            success: function(data){
                alert(data);
                window.location.reload()

            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest.status);
                alert(XMLHttpRequest.readyState);
                alert(textStatus);
            },
        });
    }
</script>
</head>
<body>
    <input type="text" placeholder="账号" id="inputText1">
    <input type="text" placeholder="密码" id="inputText2">
    <button type="button" onclick="f()">提交</button>
</body>
</html>